/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.community.component.spreadsheet.prepare;

import cn.ac.nercis.pes.community.component.spreadsheet.BaseSheetView;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import lombok.extern.slf4j.Slf4j;
import org.controlsfx.control.spreadsheet.GridBase;
import org.controlsfx.control.spreadsheet.SpreadsheetCell;

import java.util.List;

/**
 * 测评项目组成员表控件
 * @author zpy
 * @version 1.0.0
 */
@Slf4j
public class EvalPlanFastSheetView extends BaseSheetView {
    private final static Integer DATA_COUNT = 4;
    private final static List<String> COLUMNS = List.of("测评流程","测评计划（开始）","测评计划（结束）");
    private final static Integer NAME_COLUMN_INDEX = 0;
    private final static Integer START_COLUMN_INDEX = 1;
    private final static Integer END_COLUMN_INDEX = 2;

    public EvalPlanFastSheetView(){
        this.getStyleClass().add("pes-sheet-view");

        var grid = new GridBase(DATA_COUNT, COLUMNS.size());
        grid.getColumnHeaders().addAll(COLUMNS);
        buildGrid(grid);
        setGrid(grid);

        getColumns().get(NAME_COLUMN_INDEX).setPrefWidth(200);
        getColumns().get(START_COLUMN_INDEX).setPrefWidth(240);
        getColumns().get(END_COLUMN_INDEX).setPrefWidth(240);
    }

    protected void buildGrid(GridBase grid){
        ObservableList<ObservableList<SpreadsheetCell>> rows = FXCollections.observableArrayList();

    }

    private void generateRowCell(ObservableList<ObservableList<SpreadsheetCell>> rows,String name,Integer rowIndex){
        ObservableList<SpreadsheetCell> data = FXCollections.observableArrayList();
        data.add(getTextFieldCell(rowIndex,NAME_COLUMN_INDEX,name,false));

    }

    @Override
    protected void deleteData() {

    }
}